package com.docker.fjk.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.docker.common.annotation.Log;
import com.docker.common.core.controller.BaseController;
import com.docker.common.core.domain.AjaxResult;
import com.docker.common.enums.BusinessType;
import com.docker.fjk.domain.DockerProject;
import com.docker.fjk.service.IDockerProjectService;
import com.docker.common.utils.poi.ExcelUtil;
import com.docker.common.core.page.TableDataInfo;

/**
 * 检查项目设置Controller
 * 
 * @author ruoyi
 * @date 2025-04-09
 */
@RestController
@RequestMapping("/system/project")
public class DockerProjectController extends BaseController
{
    @Autowired
    private IDockerProjectService dockerProjectService;

    /**
     * 查询检查项目设置列表
     */
    @PreAuthorize("@ss.hasPermi('system:project:list')")
    @GetMapping("/list")
    public TableDataInfo list(DockerProject dockerProject)
    {
        startPage();
        List<DockerProject> list = dockerProjectService.selectDockerProjectList(dockerProject);
        return getDataTable(list);
    }

    /**
     * 导出检查项目设置列表
     */
    @PreAuthorize("@ss.hasPermi('system:project:export')")
    @Log(title = "检查项目设置", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, DockerProject dockerProject)
    {
        List<DockerProject> list = dockerProjectService.selectDockerProjectList(dockerProject);
        ExcelUtil<DockerProject> util = new ExcelUtil<DockerProject>(DockerProject.class);
        util.exportExcel(response, list, "检查项目设置数据");
    }

    /**
     * 获取检查项目设置详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:project:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(dockerProjectService.selectDockerProjectById(id));
    }

    /**
     * 新增检查项目设置
     */
    @PreAuthorize("@ss.hasPermi('system:project:add')")
    @Log(title = "检查项目设置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody DockerProject dockerProject)
    {
        return toAjax(dockerProjectService.insertDockerProject(dockerProject));
    }

    /**
     * 修改检查项目设置
     */
    @PreAuthorize("@ss.hasPermi('system:project:edit')")
    @Log(title = "检查项目设置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody DockerProject dockerProject)
    {
        return toAjax(dockerProjectService.updateDockerProject(dockerProject));
    }

    /**
     * 删除检查项目设置
     */
    @PreAuthorize("@ss.hasPermi('system:project:remove')")
    @Log(title = "检查项目设置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(dockerProjectService.deleteDockerProjectByIds(ids));
    }
}
